<?php  
    include('inc/init.php');

    
    if ( !isset($_SESSION['ba_user_id']) )
    {
        m::c ('user');
        if ( user::login() == 0 )
        {
            
            echo '<a href="index.php">Нужно пройти авторизацию</a>';
            die();
        }
    }

    if ( !isset($_GET['page']) )
    {
        include_once(PAGE_PATH . 'admin.index.php');
    }
    else
    {
        if ( is_file( PAGE_PATH . m::check_path( $_GET['page'] ).'.php' ) )
        {
            include_once( PAGE_PATH . m::check_path( $_GET['page'] ).'.php' ); 
        }
        else
        {
            echo 'error';
        }
    }	

    include('inc/end.php');
?>